program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  arr = array [0 .. 1] of integer;

var
  mass: array of arr;
  n, i, j, a, sum: integer;

begin
  sum:= 0;
  read (n);
  setlength (mass, n*n shr 1);
  for i := 1 to n do
    for j := 1 to n do
    begin
      read (a);
      if (i<j) and (a=1) then
      begin
        mass[sum, 0]:= i;
        mass[sum, 1]:= j;
        inc (sum);
      end;
    end;
  for i := 0 to sum - 1 do
    writeln (mass[i, 0], ' ', mass[i, 1]);
end.
